<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../common.inc" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./js/form.js"></script>
<script type="text/javascript" language="javascript">
<!--
	function checkForm(){
		var ids = document.getElementsByName("id");
		var sign = 0;
		for(var i = 0; i < ids.length;i++){
			if(ids[i].value != "0" && ids[i].checked){
				sign = sign + 1;
			}
		}
		if(sign <= 0){
			alert("请选择要操作的单据！");
			return false;
		}
		return true;
	}

	function selectType(){
		var obj = document.getElementById("auditType");
		if(obj.value == 1){
			window.location.href = "./auditManage.do?action=preAuditContract";
		}else if(obj.value == 2){
			window.location.href = "./auditManage.do?action=preAuditSaleCost";
		}
		window.location.target = "main";
	}
	
	function auditContract(){
		if(checkForm()){
			document.auditContractForm.action = "./auditManage.do?action=auditContract";
			document.auditContractForm.target = "main";
			document.auditContractForm.submit();
		}
	}
	
	function returnContract(){
		if(checkForm()){
			document.auditContractForm.action = "./auditManage.do?action=returnContract";
			document.auditContractForm.target = "main";
			document.auditContractForm.submit();
		}
	}
	
	function pageContract(flag){
		document.auditContractForm.action = "./auditManage.do?action=preAuditContract&flag="+flag;
		document.auditContractForm.target = "main";
		document.auditContractForm.submit();
	}
	
	function initPage(){
		if("<c:out value='${result}'/>" == 1){
			alert("操作成功！");
		}
	}
-->
</script>
</head>
<body onload="initPage()">
<form name="auditContractForm" action="" method="post">
	<table class="table_frame">
		<tr>
			<td>
				<table class="table_title1">
					<tr>
						<td class="title_lab" colspan="2">审批动态</td>
					</tr>
					<tr>
						<td valign="bottom" class="a_tools" style="padding-left: 3px;padding-top: 4px;">
							<!-- 
							审核类别：
							<select id="auditType">
								<option value="1">销售合同审核&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
								<option value="2">销售费用审核</option>
							</select>
							<a class="search" href="javascript:selectType();" target="main" hidefocus="true">查询</a>
							|
							<a class="audit" href="javascript:auditContract();" hidefocus="true">审核</a>
							<a class="return" href="javascript:returnContract();" hidefocus="true">退回</a>
							 -->
						</td>
						<td></td>
					</tr>
					<tr><td height="2" colspan="2"></td></tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<table class="table_title2">
					<tr>
						<td class="title_lab">审批动态</td>
					</tr>
					<tr>
						<td>
							<table class="table">
								<tr>
									<td valign="top">
										<div style="width:100%;height:420px;overflow-x: hidden;overflow-y: scroll;">
										<table class="table_style">
											<tr>
												<td class="title" width="8"></td>
												<td class="title" width="12%">审批类型</td>
												<td class="title" width="12%">审批状态</td>
												<td class="title" width="">单据编号</td>
												<td class="title" width="12%">申请人</td>
												<td class="title" width="12%">申请日期</td>
												<td class="title" width="12%">审核人</td>
												<td class="title" width="12%">审核日期</td>
											</tr>
											<c:forEach var="contract" items="${auditContracts}">
											<tr onmouseover="onmousemoveChange(this,'img${contract.id}')" onmouseout="onmouseoutChange(this,'img${contract.id}')">
												<td height="16" width="8" align="right"><img id="img${contract.id}" src="./images/table_sign2.bmp"></td>
												<td>合同</td>
												<td>待审核</td>
												<td><a href="./contract.do?action=contractDetail&sign=7&id=${contract.id}" target="main">${contract.contractCode}</a></td>
												<td>${contract.salePerson}</td>
												<td><fmt:formatDate value="${contract.createDate}" pattern="yyyy-MM-dd"/></td>
												<td></td>
												<td></td>
											</tr>
											</c:forEach>
											<c:forEach var="contract" items="${passContracts}">
											<tr onmouseover="onmousemoveChange(this,'img${contract.id}')" onmouseout="onmouseoutChange(this,'img${contract.id}')">
												<td height="16" width="8" align="right"><img id="img${contract.id}" src="./images/table_sign2.bmp"></td>
												<td>合同</td>
												<td>已通过审核</td>
												<td><a href="./contract.do?action=contractDetail&sign=7&id=${contract.id}" target="main">${contract.contractCode}</a></td>
												<td>${contract.salePerson}</td>
												<td><fmt:formatDate value="${contract.createDate}" pattern="yyyy-MM-dd"/></td>
												<td>${contract.auditPerson}</td>
												<td><fmt:formatDate value="${contract.auditDate}" pattern="yyyy-MM-dd"/></td>
											</tr>
											</c:forEach>
											<c:forEach var="contract" items="${returnContracts}">
											<tr onmouseover="onmousemoveChange(this,'img${contract.id}')" onmouseout="onmouseoutChange(this,'img${contract.id}')">
												<td height="16" width="8" align="right"><img id="img${contract.id}" src="./images/table_sign2.bmp"></td>
												<td>合同</td>
												<td>未通过审核，被退回</td>
												<td><a href="./contract.do?action=contractDetail&sign=7&id=${contract.id}" target="main">${contract.contractCode}</a></td>
												<td>${contract.salePerson}</td>
												<td><fmt:formatDate value="${contract.createDate}" pattern="yyyy-MM-dd"/></td>
												<td></td>
												<td></td>
											</tr>
											</c:forEach>
											
											<c:forEach var="saleCost" items="${auditSaleCosts}" varStatus="s">
											<tr onmouseover="onmousemoveChange(this,'img${s.count*1}')" onmouseout="onmouseoutChange(this,'img${s.count*1}')">
												<td height="16" width="8" align="right"><img id="img${s.count*1}" src="./images/table_sign2.bmp"></td>
												<td>费用</td>
												<td>待审核</td>
												<td><a href="#" target="main">${saleCost.saleCostCode}</a></td>
												<td>${saleCost.applyPerson}</td>
												<td><fmt:formatDate value="${saleCost.applyDate}" pattern="yyyy-MM-dd"/></td>
												<td></td>
												<td></td>
											</tr>
											</c:forEach>
											
											<c:forEach var="saleCost" items="${passSaleCosts}" varStatus="s">
											<tr onmouseover="onmousemoveChange(this,'img${s.count*2}')" onmouseout="onmouseoutChange(this,'img${s.count*2}')">
												<td height="16" width="8" align="right"><img id="img${s.count*2}" src="./images/table_sign2.bmp"></td>
												<td>费用</td>
												<td>已通过审核</td>
												<td><a href="#" target="main">${saleCost.saleCostCode}</a></td>
												<td>${saleCost.applyPerson}</td>
												<td><fmt:formatDate value="${saleCost.applyDate}" pattern="yyyy-MM-dd"/></td>
												<td>${saleCost.auditPerson}</td>
												<td><fmt:formatDate value="${saleCost.auditDate}" pattern="yyyy-MM-dd"/></td>
											</tr>
											</c:forEach>
											
											<c:forEach var="saleCost" items="${returnSaleCosts}" varStatus="s">
											<tr onmouseover="onmousemoveChange(this,'img${s.count*3}')" onmouseout="onmouseoutChange(this,'img${s.count*3}')">
												<td height="16" width="8" align="right"><img id="img${s.count*3}" src="./images/table_sign2.bmp"></td>
												<td>费用</td>
												<td>未通过审核，被退回</td>
												<td><a href="#" target="main">${saleCost.saleCostCode}</a></td>
												<td>${saleCost.applyPerson}</td>
												<td><fmt:formatDate value="${saleCost.applyDate}" pattern="yyyy-MM-dd"/></td>
												<td></td>
												<td></td>
											</tr>
											</c:forEach>
										</table>
										</div>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</form>	
</body>
</html>